﻿// =================================================================== 
// 项目说明
//====================================================================
// lsc @Copy Right 2019
// 文件： GroupCommentImageRepository.cs
// 项目名称：斑马车务
// 创建时间：2019-10-16
// 负责人：lsc
// ===================================================================
using System;
using System.Text;
using System.Collections.Generic;
using YouWei.Infrastructure.Entity;

namespace YouWei.Infrastructure.Repository
{
	/// <summary>
	///内容图片 仓储层
	/// </summary>	
	public class GroupCommentImageRepository:BaseRepository<GroupCommentImage>
	{		
    
        #region 构造

        public GroupCommentImageRepository() : base(){}

        public GroupCommentImageRepository(string connectionString) : base(connectionString){}

        public GroupCommentImageRepository(DatabaseContext dbContext) : base(dbContext){}

        #endregion
        /// <summary>
        /// 根据内容ID查询图片列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="commentId"></param>
        /// <returns></returns>
        public List<GroupCommentImage> PagesByCommentID(int GroupCommentID)
        {
            StringBuilder sb = new StringBuilder("SELECT * FROM [GroupCommentImage] T1 WITH(NOLOCK) ");
            sb.Append(" WHERE T1.IsActvie=1 AND T1.GroupCommentID = @GroupCommentID");
            sb.Append(" ORDER BY T1.ImageSort ASC");
            return Query(sb.ToString(), new { GroupCommentID });
        }
        /// <summary>
        /// 根据多个内容ID查询图片列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="ids"></param>
        /// <returns></returns>
        public List<GroupCommentImage> PagesByCommentIDs(string ids)
        {
            StringBuilder sb = new StringBuilder("SELECT * FROM [GroupCommentImage] T1 WITH(NOLOCK) ");
            sb.Append(" WHERE T1.IsActvie=1 AND T1.GroupCommentID in (" + ids + ")");
            sb.Append(" ORDER BY T1.ImageSort ASC");
            return Query(sb.ToString());
        }
    }
}